﻿Public Class congty
    Private _dsnv As List(Of nhanvien)

    Public Sub Nhap()
        Dim soPhanTu As Integer
        Console.WriteLine("Nhap so nhan vien:")
        soPhanTu = Convert.ToInt32(Console.ReadLine())
        _dsnv = New List(Of nhanvien)()

        For i As Integer = 0 To soPhanTu - 1
            Dim nv As nhanvien
            Dim loainv As Integer
            Console.Write("Nhap loai nhan vien(0:Van Phong ; 1: San Xuat ; 2: Quan Ly):")
            loainv = Convert.ToInt32(Console.ReadLine())
            If loainv = 0 Then
                nv = New nvvanphong()
            ElseIf loainv = 1 Then
                nv = New nvsanxuat()
            Else
                nv = New nvquanly()
            End If
            nv.Nhap()
            _dsnv.Add(nv)
        Next
    End Sub

    Public Sub Xuat()
        For i As Integer = 0 To _dsnv.Count - 1
            Console.WriteLine("Thong tin nhan vien {0}:", i + 1)
            _dsnv(i).Xuat()
        Next
    End Sub

    Public Function TinhTongLuong(ByVal sonc As Integer) As Double
        Dim tongluong As Double = 0
        For i As Integer = 0 To _dsnv.Count - 1
            tongluong += _dsnv(i).TinhLuong(sonc)

        Next
        Return tongluong
    End Function

End Class
